<?php

/**
 * NeoBasesYCondiciones form.
 *
 * @package    neoTrainner
 * @subpackage form
 * @author     Your name here
 */
class NeoBasesYCondicionesForm extends BaseNeoBasesYCondicionesForm {

    public function configure() {
        unset(
                $this['created_at'], $this['updated_at']
        );

        /*
         * tinyMCE: página de referencia http://wiki.moxiecode.com/index.php/TinyMCE:Control_reference#Default_buttons_available_in_the_advanced_theme
         */
        $tinyMCEConfig = "theme_advanced_buttons1: 'undo,redo,|,bold,italic,underline";
        $tinyMCEConfig.= ",|,strikethrough,justifyleft,justifycenter,justifyright,justifyfull";
        $tinyMCEConfig.= ",|,bullist,numlist,|'";
        $tinyMCEConfig.= ",theme_advanced_buttons2: 'forecolor,backcolor,|,hr,fontsizeselect,forecolor,backcolor,charmap";
        $tinyMCEConfig.= ",|,link,unlink,|'";
        $tinyMCEConfig.= ",theme_advanced_buttons3: ''";
        $tinyMCEConfig.= ",theme_advanced_resizing : false";
        $tinyMCEConfig.= ",theme_advanced_path : false";
        $tinyMCEConfig.= ",theme_advanced_statusbar_location : 'none'";

        $this->widgetSchema['contenido'] = new sfWidgetFormTextareaTinyMCE(array(
                    'width' => 500,
                    'height' => 350,
                    'config' => $tinyMCEConfig
                ));

        /* Contenido */
        $this->validatorSchema['contenido'] = new sfValidatorAnd(
                        array(
                            $this->validatorSchema['contenido'],
                            new sfValidatorString(
                                    array('min_length' => 4),
                                    array(
                                        'min_length' => 'El contenido "%value%" es demasiado corto. Debe tener al menos %min_length% caracteres.'
                                    )
                            )
                        )
        );
    }

}
